<?php
	require_once( 'core_DataBaseConnect.php' );
	require_once( 'core_ErrorCode.php' );
	require_once( 'core_Response.php' );
	require_once( 'core_FileManager.php' );
	require_once( 'dao_MemberDAO.php' );
	require_once( 'dao_ModelDAO.php' );
	require_once( '_configs.php' );
	
	function func( $con, $post, $returnType )
	{
		$login_member_id 	= $post[ 'login_member_id' ];
		// 0. 작성 권한 설정 ( 회원 )
		if( MemberDAO::isAccessable( $con, $login_member_id, array( configs::AUTHOR_ADMIN, configs::AUTHOR_MANAGER, configs::AUTHOR_MEMBER ) ) == false )
		{
			// 작성권한 없음
			return Response::FAIL( ErrorCode::FAIL_WRITE_AUTHOR, "조회 권한이 없습니다.", $returnType );
		}
		
		$response = array();
		$response[ 'sns' ] = array();
		// 링크 추가
		$result = ModelDAO::selectModelSns( $con, $post[ 'modelCode' ] );
		while( $fetch = DataBaseConnect::fetch_assoc( $result ) )
		{
			array_push( $response[ 'sns' ], DataBaseConnect::fetchSerialize( $fetch, array( 'SEQ', 'S_CODE', 'LINK' ) ) );
		}
		
		return Response::SUCCESS( $response, $returnType );
	}
?>